package org.shoukaiseki.tools.mybatis.generator.config;

import org.springframework.lang.NonNull;
import org.springframework.util.StringUtils;

/**
 * <br>
 *
 * @author 蒋カイセキ    Japan-Tokyo  18-10-23 下午2:00<br>
 * ブログ http://www.shoukaiseki.top/<br>
 * E-メール jiang28555@Gmail.com<br>
 **/
public class SqlProperties implements Cloneable {

    private String tableName;

    /**
     * 指定主键
     */
    private String primaryKey;

    /**
     * 是否显示列中获取到的表的描述,只有 showTableName =true 才有效
     */
    private boolean showTableComment=false;

    /**
     * 是否获取列中获取到的表名称
     */
    private boolean showTableName=false;

    @NonNull
    private String sql;


    /**
     * 是否生成 Model.java
     */
    private boolean generateJavaModel=true;

    @NonNull
    private String javaModelPackage;

    @NonNull
    private String domainObjectName;


    private String javaModelPath;

    /**
     * 是否生成 Mapper.xml
     */
    private boolean generateSqlMap=true;

    private String sqlMapPath;

    private String sqlMapPackage;

    /**
     * 是否生成 mapper 类
     */
    private boolean generateJavaMapper=true;

    private String javaMapperPackage;

    private String javaMapperPath;



    public String getJavaMapperPath() {
        if(StringUtils.isEmpty(javaMapperPath)){
            return javaModelPath;
        }
        return javaMapperPath;
    }

    public void setJavaMapperPath(String javaMapperPath) {
        this.javaMapperPath = javaMapperPath;
    }

    public String getJavaMapperPackage() {
        return javaMapperPackage;
    }

    public void setJavaMapperPackage(String javaMapperPackage) {
        this.javaMapperPackage = javaMapperPackage;
    }

    public String getSqlMapPath() {
        return sqlMapPath;
    }

    public void setSqlMapPath(String sqlMapPath) {
        this.sqlMapPath = sqlMapPath;
    }

    public String getSqlMapPackage() {
        return sqlMapPackage;
    }

    public void setSqlMapPackage(String sqlMapPackage) {
        this.sqlMapPackage = sqlMapPackage;
    }

    public boolean isShowTableComment() {
        return showTableComment;
    }

    public void setShowTableComment(boolean showTableComment) {
        this.showTableComment = showTableComment;
    }

    public boolean isShowTableName() {
        return showTableName;
    }

    public void setShowTableName(boolean showTableName) {
        this.showTableName = showTableName;
    }

    @NonNull
    public String getSql() {
        return sql;
    }

    public void setSql(@NonNull String sql) {
        this.sql = sql;
    }

    @NonNull
    public String getJavaModelPackage() {
        return javaModelPackage;
    }

    public void setJavaModelPackage(@NonNull String javaModelPackage) {
        this.javaModelPackage = javaModelPackage;
    }

    @NonNull
    public String getDomainObjectName() {
        return domainObjectName;
    }

    public void setDomainObjectName(@NonNull String domainObjectName) {
        this.domainObjectName = domainObjectName;
    }

    public String getJavaModelPath() {
        return javaModelPath;
    }

    public void setJavaModelPath(String javaModelPath) {
        this.javaModelPath = javaModelPath;
    }

    public SqlProperties duplication() throws CloneNotSupportedException {
        return (SqlProperties)super.clone();
    }

    public String getPrimaryKey() {
        return primaryKey;
    }

    public void setPrimaryKey(String primaryKey) {
        this.primaryKey = primaryKey;
    }

    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    public boolean isGenerateJavaMapper() {
        return generateJavaMapper;
    }

    public void setGenerateJavaMapper(boolean generateJavaMapper) {
        this.generateJavaMapper = generateJavaMapper;
    }

    public boolean isGenerateSqlMap() {
        return generateSqlMap;
    }

    public void setGenerateSqlMap(boolean generateSqlMap) {
        this.generateSqlMap = generateSqlMap;
    }

    public boolean isGenerateJavaModel() {
        return generateJavaModel;
    }

    public void setGenerateJavaModel(boolean generateJavaModel) {
        this.generateJavaModel = generateJavaModel;
    }
}
